Skip to content

added support for typescript config files#3840

Merged
ntotten merged 1 commit intomainfrom
new_config_files
Nov 28, 2025
Merged

added support for typescript config files#3840
ntotten merged 1 commit intomainfrom
new_config_files

Conversation

@ntotten
Copy link
Member

@ntotten ntotten commented Nov 28, 2025

Supersedes #3775

Copilot AI review requested due to automatic review settings November 28, 2025 19:08
@ntotten ntotten merged commit 569cff4 into main Nov 28, 2025
17 checks passed
@ntotten ntotten deleted the new_config_files branch November 28, 2025 19:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for TypeScript configuration files introduced in Prettier 3.5.0, allowing the extension to recognize and watch .prettierrc.ts, .prettierrc.cts, .prettierrc.mts, prettier.config.ts, prettier.config.cts, and prettier.config.mts files. This extends the existing support for JavaScript config files to include their TypeScript equivalents.

Key Changes:

  • Extended PRETTIER_CONFIG_FILES array to include all TypeScript config file variants
  • Added comprehensive test fixture and test case to validate TypeScript config file support
  • Updated workspace configuration and documentation

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/PrettierEditService.ts Added six TypeScript config file extensions to PRETTIER_CONFIG_FILES array for file system watching, maintaining logical grouping with JavaScript variants
src/test/suite/ts-config.test.ts New test file validating TypeScript config file support, following established test patterns with describe/it and format helper usage
test-fixtures/ts-config/prettier.config.ts TypeScript config file test fixture using typed imports and ESM syntax, specifying formatting rules (tabWidth: 4, singleQuote: true, trailingComma: "es5")
test-fixtures/ts-config/package.json Test fixture package configuration with "type": "module" and Prettier 3.5.0+ dependency to enable TypeScript config parsing
test-fixtures/ts-config/index.js Unformatted input file for testing config application
test-fixtures/ts-config/index.result.js Expected formatted output demonstrating proper application of TypeScript config settings
test-fixtures/test.code-workspace Added ts-config workspace folder to enable test execution
CHANGELOG.md Documented new feature with proper attribution to contributor

Comment on lines +14 to +15
},
"dependencies": {}
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The empty dependencies object is unnecessary and can be removed. While this pattern also exists in the v3 test fixture (test-fixtures/v3/package.json:14), other fixtures like esm-config and v2-explicit omit this empty object entirely. Consider removing it to keep the package.json minimal and consistent with fixtures that don't use it.

Suggested change
},
"dependencies": {}
}

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,6 @@
// Test file for TypeScript config
const example = { foo: 'bar', baz: 123, qux: true };
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable example.

Suggested change
const example = { foo: 'bar', baz: 123, qux: true };

Copilot uses AI. Check for mistakes.
Comment on lines +4 to +6
function hello(name) {
return 'Hello, ' + name + '!';
}
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused function hello.

Suggested change
function hello(name) {
return 'Hello, ' + name + '!';
}

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,6 @@
// Test file for TypeScript config
const example = {foo: "bar", baz: 123, qux: true};
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable example.

Suggested change
const example = {foo: "bar", baz: 123, qux: true};

Copilot uses AI. Check for mistakes.

function hello(name) {
return "Hello, " + name + "!";
}
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused function hello.

Suggested change
}
}
// Use the hello function to avoid unused function warning
console.log(hello("world"));

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants